#ifndef JVM_H
#define JVM_H

#include "common.h"
#include "properties.h"
#include <jni.h>

typedef /* JNIIMPORT */ jint(JNICALL *PtrCreateJavaVM)(JavaVM **pvm, JNIEnv **env, void *args);

// 表示jvm的类
class Jvm {
  private:
    Common &common;
    Properties &properties;
    PtrCreateJavaVM ptrCreateJavaVM = nullptr;
    JavaVM *jvm = nullptr;
    JNIEnv *env = nullptr;
    bool load();
    bool createJavaVM();
    bool runMainClass();

  public:
    Jvm();
    Error start();
    // bool notifySingleInstance();
};

#endif